package com.zhihuixingguang.login;

import com.zhihuixingguang.util.JSONUtil;
import com.zhihuixingguang.util.MD5;

import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;

@Setter
@Getter
@Slf4j
public class TicketCallBackRes extends BaseParam {

	private String systemid;
	private String ticket;
	private String sign;
	private String openid;
	/**
	 * 签名操作
	 * @param appsecret
	 */
	public void createSign(String appsecret) {
		String key = getAppid()+getNonce()+getTime()+"{\"systemid\":\""+systemid+"\",\"openid\":\""+openid+"\"}"+appsecret;
		log.info("待签名的数据：{}",key);
		sign = MD5.getMD5(key);
	}
	
	public static void main(String[] args) {
		TicketCallBackRes r = new TicketCallBackRes();
		r.setAppid("nzT7XmGAVQKt88us");
		r.setNonce("Jia67HYoaFrc1kkxhH7gdRIUACkTgbgl");
		r.setTicket("I2esSmtkGJyHq4Aq3Dprtz4o8CXvLJV9");
		r.setSystemid("YQMS");
		r.setTime(1664524098892L);
		r.setOpenid("hV52VWqKgZwIaPwt");
		r.createSign("igPxotNc6SKNCAFz");
		System.out.println(JSONUtil.toJSONString(r, true));
	}
}
